#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 0x7f7f7f7f
const int N = 1e5 + 10;
int r[N],n,down[N],keep[N];
struct node{
    int num,nxt;
}p[N];
bool cmp(node a,node b){
    return a.num < b.num;
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    int tp = 0;
    for(int i = 1;i <= n;i++){
        int t;
        cin >> t;
        if(r[t] == 0) p[++tp].num = t;
        r[t]++;
        keep[i]++;
    }
    sort(p + 1,p + tp + 1,cmp);
    int quit = 0,cnt = tp;
    for(int i = 1;i < tp;i++){
        p[i].nxt = i + 1;
    }
    int head = 1;
    r[0] = INF;
    p[0].nxt = INF;
    while(cnt > 1){
        for(int i = tp;i >= 1;i--){
            if(r[p[i].num] > 0){
                r[p[i].num] -= down[p[i].num];
                if(r[p[p[i].nxt].num] == 0) p[i].nxt = p[p[i].nxt].nxt;
                if(r[p[i].num] == 0) cnt--;
            }
            down[p[i].num] = 0;
        }
        for(int i = head;p[i].nxt != INF;i = p[i].nxt){
            if(r[p[i].num] == 0) continue;
            else if(r[p[head].num] == 0) head = i;
            if(p[i].nxt != 0) down[p[i].num] = max(down[p[i].num],min(r[p[i].num],r[p[p[i].nxt].num]));
            down[p[p[i].nxt].num] = min(r[p[i].num],r[p[p[i].nxt].num]);
            if(p[i].nxt != 0) quit += min(r[p[i].num],r[p[p[i].nxt].num]);
        }
    }
    cout << n - quit;
    return 0;
}
